#ifndef CONFIG_HPP
#define CONFIG_HPP

#include "Types.hpp"
#include <string>


namespace netspy
{

class Config
{

	
public:
	static Config &getInstance()
	{
		static Config config;
		return config;
	}

	void parseCommandLine(int argc, char *argv[]) throw(int); 
	void setDefaultValues();	
	bool isVerbose() const;
	uint32_t getCheckPeriod() const;
	uint16_t getRegisterPort() const;
        const char * getDatabaseName() const;
        const char * getDatabaseUser() const;
        const char * getDatabasePass() const;
	uint32_t getCheckerThreadNumber() const;			

private:
	Config();
	Config(const Config &);
        Config& operator=(const Config&);
		

	uint32_t checkPeriod_;
	uint16_t registerPort_;
	bool isVerbose_;
        const char * databaseName_;
        const char * databaseUser_;
        const char * databasePass_;
	uint32_t checkerThreadNumber_;


	static const uint32_t defaultCheckPeriod = 60; // seconds
	static const uint32_t defaultCheckerThreadNumber = 10;
	static const char * configFilename() { return "spynet-server.conf"; }
	static const bool     defaultVerbose = true;
	static const uint16_t defaultRegisterPort = 5000;
        static const char * defaultDatabaseName(){ return "netspy"; }  
        static const char * defaultDatabaseUser(){ return "root"; }
        static const char * defaultDatabasePass(){ return "root"; }

};

}

#endif
